#!/usr/bin/env node

const http = require('http'),
    fs = require('fs'),
    {join}  = require('path');

http.createServer((req,res) => {
    //console.log(req.url)
    console.time('TEXT')
    let file = join(_dirfile,req.url)
    //console.log(file)
    if(!fs.existsSync(file)){
        res.end(`${req.url} not exists`);
        return;
    }
    console.logg(mem())//基本测试
    fs.createReadStream(file).pipe(res);
    console.timeEnd('TEXT')
}).listen(8080)